﻿<UserControl x:Class="MixModes.Synergy.Web.VisualFramework.Windows.WindowsManager"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:local="clr-namespace:MixModes.Synergy.Web.VisualFramework.Windows"
             xmlns:Controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:behaviors="clr-namespace:MixModes.Synergy.Web.VisualFramework.Behaviors"
             xmlns:Controls1="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
             xmlns:Controls2="clr-namespace:MixModes.Synergy.Web.VisualFramework.Controls"
             mc:Ignorable="d"
             d:DesignHeight="300"
             d:DesignWidth="400">

    <local:WindowsManager.DockIllustrationContentStyle>

        <!-- Style for illustrating content docking in windows manager -->
        <Style TargetType="Controls1:TabItem">
            <Setter Property="ContentTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Grid Background="{StaticResource DockIllustrationBrush}"
                              Margin="-4" />
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Controls1:TabItem">
                        <Grid Background="{StaticResource DockIllustrationBrush}"
                              Width="50" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="VerticalContentAlignment"
                    Value="Stretch" />
            <Setter Property="HorizontalContentAlignment"
                    Value="Stretch" />
        </Style>

    </local:WindowsManager.DockIllustrationContentStyle>

    <local:WindowsManager.DockPaneIllustrationStyle>

        <!-- DockIllustrationGrid default style -->
        <Style TargetType="Grid">
            <Setter Property="Background"
                    Value="{StaticResource DockIllustrationBrush}" />
        </Style>

    </local:WindowsManager.DockPaneIllustrationStyle>
    <UserControl.Resources>
        <Style x:Key="DockPointBorder"
               TargetType="Border">
            <Setter Property="BorderBrush"
                    Value="Transparent" />
            <Setter Property="BorderThickness"
                    Value="2" />
            <Setter Property="HorizontalAlignment"
                    Value="Center" />
            <Setter Property="VerticalAlignment"
                    Value="Center" />
        </Style>

        <Style TargetType="Image">
            <Setter Property="Stretch"
                    Value="None" />
        </Style>

    </UserControl.Resources>
    <Grid x:Name="LayoutRoot">

        <!-- Overall dock panel -->
        <Controls:DockPanel LastChildFill="True">

            <!-- Top Window Headers -->
            <StackPanel Controls:DockPanel.Dock="Top"
                        x:Name="TopWindowHeaders"
                        Orientation="Horizontal" />

            <!-- Left Window Headers -->
            <Controls2:SidewaysStackPanel Controls:DockPanel.Dock="Left"
                                          x:Name="LeftWindowHeaders" />

            <!-- Right Window Headers -->
            <Controls2:SidewaysStackPanel Controls:DockPanel.Dock="Right"
                                          x:Name="RightWindowHeaders" />

            <!-- Bottom Window Headers -->
            <StackPanel Orientation="Horizontal"
                        Controls:DockPanel.Dock="Bottom"
                        x:Name="BottomWindowHeaders" />

            <!-- We need to group content and pinned windows in a single grid parent since
                 we want floating windows to avoid overlapping with window headers -->
            <Grid>
                <Controls:DockPanel LastChildFill="True">

                    <!-- Left Pinned Windows -->
                    <Controls:DockPanel x:Name="LeftPinnedWindows"
                                        Controls:DockPanel.Dock="Left"
                                        LastChildFill="False" />

                    <!-- Right Pinned Windows -->
                    <Controls:DockPanel x:Name="RightPinnedWindows"
                                        Controls:DockPanel.Dock="Right"
                                        LastChildFill="False" />

                    <!-- Top Pinned Windows -->
                    <Controls:DockPanel x:Name="TopPinnedWindows"
                                        Controls:DockPanel.Dock="Top"
                                        LastChildFill="False" />

                    <!-- Bottom Pinned Windows -->
                    <Controls:DockPanel x:Name="BottomPinnedWindows"
                                        Controls:DockPanel.Dock="Bottom"
                                        LastChildFill="False" />

                    <!-- Document and Docking illustration panels -->
                    <Grid>

                        <local:DocumentContainer x:Name="DocumentContainer" />

                        <!-- Illustrates future window docked position -->
                        <Controls:DockPanel x:Name="DockingIllustrationPanel"
                                            LastChildFill="False" />

                    </Grid>
                </Controls:DockPanel>

                <!-- Area for non-pinned windows to show up -->
                <Controls:DockPanel x:Name="PopupArea"
                                    LastChildFill="False" />
            </Grid>

        </Controls:DockPanel>

        <Canvas x:Name="FloatingPanel"
                ScrollViewer.HorizontalScrollBarVisibility="Hidden"
                ScrollViewer.VerticalScrollBarVisibility="Hidden" />

        <Controls:DockPanel x:Name="DockingPanel"
                            Visibility="Collapsed"
                            LastChildFill="false">

            <Border Controls:DockPanel.Dock="Top"
                    Style="{StaticResource DockPointBorder}">
                <i:Interaction.Behaviors>
                    <behaviors:DockPointBehavior />
                </i:Interaction.Behaviors>
                <Image Source="/MixModes.Synergy.Web.VisualFramework;component/Resources/DockTop.png"
                       Stretch="None" />
            </Border>

            <Border Controls:DockPanel.Dock="Left"
                    Style="{StaticResource DockPointBorder}">
                <i:Interaction.Behaviors>
                    <behaviors:DockPointBehavior />
                </i:Interaction.Behaviors>
                <Image Source="/MixModes.Synergy.Web.VisualFramework;component/Resources/DockLeft.png"
                       Stretch="None" />
            </Border>

            <Border Controls:DockPanel.Dock="Right"
                    Style="{StaticResource DockPointBorder}">
                <i:Interaction.Behaviors>
                    <behaviors:DockPointBehavior />
                </i:Interaction.Behaviors>
                <Image Source="/MixModes.Synergy.Web.VisualFramework;component/Resources/DockRight.png"
                       Stretch="None" />
            </Border>

            <Border Controls:DockPanel.Dock="Bottom"
                    Style="{StaticResource DockPointBorder}">
                <i:Interaction.Behaviors>
                    <behaviors:DockPointBehavior />
                </i:Interaction.Behaviors>
                <Image Source="/MixModes.Synergy.Web.VisualFramework;component/Resources/DockBottom.png"
                       Stretch="None" />
            </Border>
        </Controls:DockPanel>

    </Grid>

</UserControl>
